import request from '@/utils/request.js'

// 分页查询
export const reservationListService = (params) => {
    return request.get('/locationRecord/selectPage', { params })
}

// 根据编号查询
export const findReservationService = (number) => {
    return request.get('/locationRecord/findByNumber?number=' + number)
}

// 删除
export const deleteReservationService = (id) => {
    return request.delete('/locationRecord/delete?id=' + id)
}

// 批量删除
export const batchDeleteReservationService = (ids) => {
    return request.delete('/locationRecord/delete/batch', { data: ids })
}

// 取消预约
export const cancelAppointmentService = (id) => {
    return request.post('/locationRecord/updateByAdmin?id=' + id)
}

// 创建预约
export const createReservationService = (data) => {
    return request.post('/locationRecord/create', data)
}

// 更新预约
export const updateReservationService = (data) => {
    return request.post('/locationRecord/update', data)
}

// 根据用户ID查询预约记录
export const findReservationByUserIdService = () => {
    return request.get('/locationRecord/findByUserId')
}

// 根据地点ID查询预约记录
export const findReservationByLocationIdService = (locationId) => {
    return request.get('/locationRecord/findByLocationId?locationId=' + locationId)
}

// 更新属于用户的预约记录
export const updateByUserService = (id) => {
    return request.post('/locationRecord/updateByUser', { id })
}
